﻿using System;
using System.Linq;
using System.Web.Mvc;
using BLL;
using Model;


namespace Web.Areas.Manager.Controllers
{
    [UserAuthorize]
    public class VerifyStateController : Controller
    {
        VerifyState_BLL _VerifyState_BLL = new VerifyState_BLL();

        public virtual ActionResult Index(int? pageIndex, string keyword)
        {
            var model = _VerifyState_BLL.Get();
            if (!string.IsNullOrEmpty(keyword))
            {
                //  model = model.Where(a => a.UserName.Contains(keyword));
            }
            return View(model.ToPagedList(pageIndex));
        }


        public virtual ActionResult Details(Guid Id)
        {
            var item = _VerifyState_BLL.Get(Id);
            return View(item);
        }

        public virtual ActionResult Edit(Guid? Id)
        {
            var item = _VerifyState_BLL.Get(Id);
            return View(item);
        }

        [HttpPost]
        public virtual ActionResult Edit(Guid? Id, VerifyState collection)
        {
            if (!ModelState.IsValid)
            {
                return View(collection);
            }
            _VerifyState_BLL.Save(Id, ref collection);
            return RedirectToAction("Index", RouteData.Values);
        }

        [HttpDelete]
        public virtual ActionResult Delete(Guid Id)
        {
            _VerifyState_BLL.Delete(Id);
            return RedirectToAction("Index", RouteData.Values);
        }
    }
}
